﻿using SH.Order.Domain.OrderClass;
using SH.Order.ErrorCodeEnum;
using SH.Order.Infrastructure.IRepository;
using SQLitePCL;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SH.Order.Infrastructure.Repository
{
    public class OrderRepository : BaseRepository<OrderInfo>, IOrderRepository
    {
        private readonly ISqlSugarClient _context;
        public OrderRepository(ISqlSugarClient context) : base(DbManger.BizDb)
        {
            _context = DbManger.BizDb;
        }
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int Delete1(int id)
        {
            _context.Open();
            var order = _context.Queryable<OrderInfo>().Single(x => x.Id == id);
            order.IsDelete = false;
            var result = _context.Updateable<OrderInfo>(order).ExecuteCommand();
            return result;
        }
    }

}
